package com.hungryinlindholmen;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Logout
 * 
 * Logs out the user by redirecting to first page for a consumer and sets ID of
 * owner to blank.
 * 
 * @author Olof Ekelund
 */

@WebServlet("/Logout")
public class Logout extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public Logout() {
	super();

    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    @Override
    protected void doGet(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {
	request.getSession().setAttribute("restID", "");

	RequestDispatcher dispatcher = request
		.getRequestDispatcher("/SearchServlet?Search=&meal=lunch&price=&weekday=today");
	dispatcher.forward(request, response);
	return;
    }
}
